from rest_framework.viewsets import ModelViewSet
from rest_framework.generics import ListAPIView

from apps.goods.models import SKUImage
from apps.meiduo_admin.serializers.image import ImageSerializer,SimpleSKUSerializer
from apps.meiduo_admin.utils import PageNum
from apps.goods.models import SKU


class ImageModelViewSet(ModelViewSet):
    # 指定查询集
    queryset = SKUImage.objects.all()
    # 指定序列化器
    serializer_class = ImageSerializer
    # 指定分页器
    pagination_class = PageNum


class SimpleSKUAPIView(ListAPIView):

    # 指定查询集
    queryset = SKU.objects.all()

    # 指定序列化器
    serializer_class = SimpleSKUSerializer
